package net.huashitong.taskjob.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.taskjob.dao.MessageListDao;
import net.huashitong.taskjob.entity.MessageList;
import net.huashitong.taskjob.filter.MessageListFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageListService extends StringPKService<MessageList> {

    @Autowired
    private MessageListDao dao;
    @Autowired
    private SysTableService tableService;

    @Override
    protected BaseDao<MessageList, String> getDao() {
        return dao;
    }
    @Override
    protected void beforeSave(MessageList obj) {
        obj.setSysId(tableService.updateMaxSysId("t_bnp_message_task_list", null));
    }

    public List<MessageList> queryNoReadMessage(MessageListFilter filter){
        return dao.queryByFilterNoPage(filter);
    }

    public List<MessageList> queryByFilter(MessageListFilter filter){
        return dao.queryByFilter(filter);
    }

}